//权限插件
Ext.ns("Thang.window");
Ext.QuickTips.init();

Ext.BLANK_IMAGE_URL = '../../extjs/resources/images/default/s.gif';

var utils=new Thang.util.Utils();

Thang.window.LoginWindow=Ext.extend(Ext.Window,{

       constructor:function(config){
		   config=config||{};
		   config.items=this.form;
		   Ext.apply(this,config);
	       Thang.window.LoginWindow.superclass.constructor.call(this);
	   },
	   flex:3,
	   width:300,
	   height:160,
	   frame:true,
	   iconCls:'icon-lock_key',
       layout:'fit',
	   closable:false,
	   closeAction:"hide",
       title:utils.bigFont('系统登陆',false,false),
	   form:[{
	       xtype:'form',
		   plain:true,
		   frame:true,
		   layout:'absolute',
		   defaultType:'textfield',
		   labelAlign:'right',
		   items:[{
		        xtype:'label',
			    html:utils.bigFont('账号：'),
			    x:15,
			    y:5
		      },{		      
			    name:'uname',
			    allowBlank:false,
			    width:160,
			    x:95,
			    y:5
		     },{
			   	xtype:'label',
			    html:utils.bigFont('密码：'),
			    x:15,
			    y:45
			 },{
			    name:'upass',
			    allowBlank:false,
			    width:160,
			    x:95,
			    y:45
		     }],
	       buttons:[{
			     text:utils.bigFont('确定'),
				 handler:function(btn,evt){
				     this.findParentByType('form').getForm().submit({
						                                              url: 'http://localhost:8080/mana/system/user/user_login.do',
                                                                      params: {
                                                                          newStatus: 'delivered'
                                                                      },
                                                                      success: function(form, action) {
                                                                          Ext.Msg.alert('Success', action.result.msg);
                                                                      },
                                                                      failure: function(form, action) {
                                                                          switch (action.failureType) {
                                                                               case Ext.form.Action.CLIENT_INVALID:
                                                                                    Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
                                                                                    break;
                                                                               case Ext.form.Action.CONNECT_FAILURE:
                                                                                    Ext.Msg.alert('Failure', 'Ajax communication failed');
                                                                                    break;
                                                                               case Ext.form.Action.SERVER_INVALID:
                                                                                    Ext.Msg.alert('Failure', action.result.msg);
                                                                           }
                                                                       }
                                                         });//submit end
				 }
			  },{
			     text:utils.bigFont('重置'),
				 handler:function(btn,evt){
				     this.findParentByType('form').getForm().reset();
				 }
			  }]
	   }]

});